package com.lpit.controller;

import com.lpit.constant.Constant;
import com.lpit.pojo.Message;
import com.lpit.service.MessageService;
import com.lpit.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin")
public class MessageController {
    @Autowired
    private MessageService messageService;
    /*推送消息给用户*/
    @PostMapping("/sendMessage/pushNotification.html")
    public Result<String> pushNotification(Message message){
        return messageService.pushNotification(message) != 0 ? Result.success(Constant.MESSAGE_INSERT_SUCCEED) : Result.error(Constant.MESSAGE_INSERT_FAIL);
    }
}
